const KoaRouter =require('@koa/router')
const router =new KoaRouter()
const checkToken = require('../middlewares/checkToken')

const AU=require('../controllers/element-admin/user')
const G=require('../controllers/element-admin/good')
const v='/api/v2'
router
.post(`${v}/user/login`,AU.login)
// 中间件验证写法
// .get(`${v}/user/info`, checkToken, AU.getUserInfo)
.get(`${v}/user/info`, AU.getUserInfo)

.get(`${v}/good/list`,G.getGoodList)
.get(`${v}/good/cate`, G.getCates)
.post(`${v}/upload/img`, G.getImage)
.post(`${v}/good/add`, G.addGoods)
.get(`${v}/good/detail`, G.GoodDetail)
.get(`${v}/good/delete`,G.deleteGood)
module.exports=router